package handler

import (
	"github.com/gin-gonic/gin"
	"choujiang/box_server/service"
	"choujiang/common/models"
	"choujiang/common/consts"
	"choujiang/common/utils"
)

/**
 @description 获取分类及分类下的游戏
 */
func GetCategoryGames(c *gin.Context) {
	uniqueId := c.Request.Form.Get("uniqueId")
	gameId := c.Request.Form.Get("gameId")
	user := model.GetUserByUniqueId(uniqueId)
	if user == nil {
		utils.Error(consts.ErrUserNotFound, c)
		return
	}
	categorys := service.GetCateGames(gameId)

	utils.JSON(categorys, c)
}
